using System;
using System.Collections.Generic;
using System.Text;
using Wrath.Xml;
using Wrath.RuleForge.Interfaces;
using System.ComponentModel;

namespace Wrath.RuleForge.Property
{
    public class IconWrapper : IPropertyWrapper<Element>
    {
        private bool hasChanged;
        private Element element;

        private Wrath.Xml.Attribute nameAttribute;
        private Wrath.Xml.Attribute fileAttribute;

        [Category("Icon")]
        [Description("The name of the icon. This is the name that other elements refer to.")]
        public string Name { get { return nameAttribute.Value; } set { nameAttribute.Value = value; } }

        [Category("Icon")]
        [Description("The relative path of the icon file.")]
        public string File { get { return fileAttribute.Value; } set { fileAttribute.Value = value; } }

        public IconWrapper(Element element)
        {
            hasChanged = false;
            this.element = element;

            nameAttribute = element.FindAttribute("name");
            fileAttribute = element.FindAttribute("file");
        }

        #region IPropertyWrapper<Element> Members

        [Browsable(false)]
        public bool HasChanged
        {
            get
            {
                return hasChanged;
            }
            set
            {
                hasChanged = value;
            }
        }

        [Browsable(false)]
        public Element Data
        {
            get { return element; }
        }

        #endregion
    }
}
